﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace T07_TaskBaseApp
{
    class Program
    {
        static void Main(string[] args)
        {
            //Test1();
            //Test2();
            Test3();

            Console.ReadLine();
        }

        static void Test1()
        {
            Task task = new Task(new Action(() =>
             {
                 Console.WriteLine("new 一个task，对应子线程ID=" + Thread.CurrentThread.ManagedThreadId);
             }));
            task.Start();
        }


        static void Test2()
        {
            Task.Run(new Action(() => 
            {
                Console.WriteLine("new 一个task，对应子线程ID=" + Thread.CurrentThread.ManagedThreadId);
            }));
        }


        static void Test3()
        {
            Task.Factory.StartNew(new Action(() => 
            {
                Console.WriteLine("new 一个task，对应子线程ID=" + Thread.CurrentThread.ManagedThreadId);
            }));
        }
    }
}
